<?php
  
  $q = " 
   select 
     p.description 
   from product p 
   where p.description regexp '" . $_REQUEST['product_regex'] . "' 
   limit 0, 10;";

  mysql_connect("localhost", "root", "password") or die( mysql_error() );
  mysql_select_db("overall_pos_db") or die( mysql_error() );

  $r = mysql_query($q) or die( mysql_error() );
  $n = mysql_numrows($r);

  for( $i = 0; $i < $n; $i++ ) {
    $e = mysql_fetch_assoc($r);
    $o[] = $e;
  }

  print( json_encode($o));

  mysql_close();
?>
